﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AddContato_Cliente.aspx.cs" Inherits="NewTierra.Pages.Cliente.AddContato_Cliente" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">

    <link rel="shortcut icon" href="../../images/Icones/favicon.ico" type="image/x-icon" />

    <link href="../../Styles/jquery_notification.css" rel="stylesheet" />

    <link href="../../Styles/jquery-ui.css" rel="stylesheet" />    
    <script type="text/javascript" src="../../Scripts/jquery-1.11.0.js"></script>
    <script type="text/javascript" src="../../Scripts/jquery-ui-1.10.0.js"></script>

    <script type="text/javascript" src="../../Scripts/jquery_notification_v.1.js"></script>

    <link href="../../Styles/EstiloGeral.css" rel="stylesheet" type="text/css" />

    <title></title>
    <style type="text/css">
        #FormContatos
        {
            height: 387px;
            width: 926px;
        }

            #FormContatos .GridContatos
            {
                float: left;
                height: 364px;
                width: 499px;
                margin-top: 10px;
            }

            #FormContatos .FormCadastroContatos
            {
                float: left;
                width: 417px;
                height: 379px;
            }

        .invisible
        {
            display: none;
        }

        #form1
        {
            width: 930px;
        }
    </style>
</head>
<body>

    <script type="text/javascript">

        jQuery(function ($) {
            $.datepicker.regional['pt-BR'] = {
                closeText: 'Fechar',
                prevText: '&#x3c;Anterior',
                nextText: 'Pr&oacute;ximo&#x3e;',
                currentText: 'Hoje',
                monthNames: ['Janeiro', 'Fevereiro', 'Mar&ccedil;o', 'Abril', 'Maio', 'Junho',
             'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'],
                monthNamesShort: ['Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun',
             'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'],
                dayNames: ['Domingo', 'Segunda-feira', 'Ter&ccedil;a-feira', 'Quarta-feira', 'Quinta-feira', 'Sexta-feira', 'Sabado'],
                dayNamesShort: ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sab'],
                dayNamesMin: ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sab'],
                weekHeader: 'Sm',
                dateFormat: 'dd/mm/yy',
                firstDay: 0,
                isRTL: false,
                showMonthAfterYear: false,
                yearSuffix: ''
            };
            $.datepicker.setDefaults($.datepicker.regional['pt-BR']);
        });

        $(function () {
            $("#txtDataNiver").datepicker({
                defaultDate: "+1w",
                changeMonth: true,
                numberOfMonths: 1
            });
        });

        function showAutoCloseMessage(MsgsExc) {
            showNotification({
                message: MsgsExc,
                autoClose: true,
                type: "success",
                duration: 5
            });
        }

    </script>

    <form id="form1" runat="server">

        <asp:ScriptManager ID="ScriptManager1" runat="server" />

        <div id="FormContatos">

            <div class="FormCadastroContatos">

                <fieldset style="height: 380px">
                    <legend>Cadastrar Contatos</legend>

                    <asp:TextBox ID="txtCodigo" CssClass="invisible" runat="server" ReadOnly="True" Width="50px" />

                    <asp:Label ID="lblNomeContatoClienteTXT" runat="server" Text="Nome:"></asp:Label>
                    <br />
                    <asp:TextBox ID="txtNome" runat="server" Width="200px" MaxLength="50" />
                    <asp:RequiredFieldValidator ID="requireNome" runat="server"
                        ControlToValidate="txtNome" ErrorMessage="*" ForeColor="Red"
                        ToolTip="Campo requerido." ValidationGroup="Salvar">
                    </asp:RequiredFieldValidator>
                    <br />

                    <asp:Label ID="lblTelefoneContatoClienteTXT" runat="server" Text="Telefone:"></asp:Label>
                    <br />
                    <asp:TextBox ID="txtTelefone" runat="server" Width="150px" MaxLength="15" />
                    <br />

                    <asp:Label ID="lblFaxContatoClienteTXT" runat="server" Text="Fax:"></asp:Label>
                    <br />
                    <asp:TextBox ID="txtFax" runat="server" Width="150px" MaxLength="15" />
                    <br />

                    <asp:Label ID="lblCargoContatoClienteTXT" runat="server" Text="Cargo:"></asp:Label>
                    <br />
                    <asp:TextBox ID="txtCargo" runat="server" Width="150px" MaxLength="50" />
                    <br />

                    <asp:Label ID="lblEmailContatoClienteTXT" runat="server" Text="Email:"></asp:Label>
                    <br />
                    <asp:TextBox ID="txtEmail" runat="server" Width="200px" MaxLength="50" />
                    <asp:RequiredFieldValidator ID="requireEmail" runat="server"
                        ControlToValidate="txtEmail" ErrorMessage="*" ForeColor="Red"
                        ToolTip="Campo requerido." ValidationGroup="Salvar">
                    </asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="regularEmail" runat="server"
                        ControlToValidate="txtEmail" ErrorMessage="*" ForeColor="Red"
                        ToolTip="Email inválido."
                        ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
                        ValidationGroup="Salvar">
                    </asp:RegularExpressionValidator>
                    <br />

                    <asp:Label ID="lblDataNiverContatoClienteTXT" runat="server" Text="Aniversário:"></asp:Label>
                    <br />
                    <asp:TextBox ID="txtDataNiver" runat="server" Width="100px" MaxLength="10" />
                    <br />

                    <asp:Label ID="lblMailingContatoClienteTXT" runat="server" Text="Mailing:"></asp:Label>
                    <br />
                    <asp:DropDownList ID="ddlMailing" runat="server" AppendDataBoundItems="true">
                        <asp:ListItem Value="True" Selected="True">Sim</asp:ListItem>
                        <asp:ListItem Value="False">Não</asp:ListItem>
                    </asp:DropDownList>
                    <br />
                    <br />

                    <asp:Label ID="lblContatoClienteTXT" runat="server" Text="Cliente:"></asp:Label>&nbsp;
         <asp:Label ID="lblContatoCliente" runat="server" Font-Size="Small"></asp:Label>
                    <br />
                    <br />

                    <asp:Button ID="btnNovoContato" CssClass="btnGeralAzul" runat="server" Text="Salvar" ValidationGroup="Salvar" OnClick="SalvarContato" />
                    &nbsp;<asp:Button ID="btnUpdateContato" CssClass="btnGeralAzul" runat="server" OnClick="AtualizarContato" Text="Atualizar" ValidationGroup="Salvar" />
                    &nbsp;&nbsp;<asp:Button ID="btnLimpar" CssClass="btnGeralAzul" runat="server" Text="Limpar" OnClick="Limpar" />
                    &nbsp;<asp:Button ID="btnFechar" CssClass="btnGeralAzul" runat="server" OnClientClick="window.close();" Text="Fechar" />
                    <br />

                    <asp:Label ID="lblMsgAddContato" runat="server" Font-Bold="True" ForeColor="#CC0000" Font-Size="Small"></asp:Label>

                </fieldset>
            </div>

            <div class="GridContatos">

                <asp:GridView ID="GridContatosCliente" runat="server" AllowPaging="True"
                    AutoGenerateColumns="False" GridLines="None" CssClass="mGrid" PagerStyle-CssClass="pgr"
                    AlternatingRowStyle-CssClass="alt" EmptyDataText="Não existe contato para esse Cliente."
                    Height="16px" PageSize="8" OnPageIndexChanging="PaginarDados">
                    <AlternatingRowStyle CssClass="alt"></AlternatingRowStyle>

                    <Columns>
                        <asp:BoundField DataField="Contato_id" HeaderText="ID" ReadOnly="True"
                            SortExpression="Contato_id" InsertVisible="False">
                            <FooterStyle CssClass="invisible" />
                            <HeaderStyle CssClass="invisible" />
                            <ItemStyle CssClass="invisible" />
                        </asp:BoundField>

                        <asp:BoundField DataField="Contato_nome" HeaderText="Nome"
                            SortExpression="Contato_nome" />

                        <asp:BoundField DataField="Contato_position" HeaderText="Cargo"
                            SortExpression="Contato_position" />

                        <asp:BoundField DataField="Contato_telefone" HeaderText="Telefone"
                            SortExpression="Contato_telefone" />

                        <asp:BoundField DataField="Contato_fax" HeaderText="Fax"
                            SortExpression="Contato_fax" />

                        <asp:BoundField DataField="Contato_email" HeaderText="Email"
                            SortExpression="Contato_email" />

                        <asp:TemplateField HeaderText="">
                            <ItemTemplate>
                                <asp:ImageButton ID="imgBtnEditarContato"
                                    runat="server" ToolTip="Editar Contato"
                                    CommandArgument='<%# Eval("Contato_id") %>'
                                    OnCommand="EditarContato" ImageUrl="~/images/Icones/edit.png" />
                            </ItemTemplate>
                            <HeaderStyle Wrap="False" />
                            <ItemStyle Wrap="False" />
                        </asp:TemplateField>

                        <asp:TemplateField HeaderText="">
                            <ItemTemplate>
                                <asp:ImageButton ID="imgBtnExcluirContato"
                                    runat="server" ToolTip="Excluir Contato"
                                    CommandArgument='<%# Eval("Contato_id") %>'
                                    OnCommand="ExcluirContato" ImageUrl="~/images/Icones/delete.png" />
                            </ItemTemplate>
                            <HeaderStyle Wrap="False" />
                            <ItemStyle Wrap="False" />
                        </asp:TemplateField>

                    </Columns>

                    <PagerStyle CssClass="pgr"></PagerStyle>

                </asp:GridView>

            </div>

        </div>

    </form>
</body>
</html>
